import time
import numpy as np
from scipy import stats
import statsmodels.api as sm
from time import time
from itertools import chain, combinations
from operator import add, mul
from math import log10, floor

from dive.base.data.access import get_data


#####################
##Time Estimation
####################

base=[[0.3062292847885516, 0.31537504274393113, 0.32595710998691196, 0.33676208776748268, 0.34637163441537616, 0.35446648213069593, 0.36211997032676146, 0.37081122232346103, 0.38106524618827292, 0.39197024474022463, 0.4020159176731109, 0.4104820246919122, 0.41810057111847715, 0.42638280557443065, 0.43622978496793186, 0.44710394692774957, 0.45752334216827639, 0.46642413182835663, 0.47413867601408882, 0.4820899634500358, 0.49148332220831042, 0.50219824663773005, 0.51289918970377368, 0.5222634587729299, 0.53019729312003772, 0.5379220671065994, 0.54685136422547231, 0.5572913349566101, 0.56815922342767788, 0.57797884816969325], [0.93185485223081288, 0.96498944459833613, 1.0035866731629612, 1.0430316851276278, 1.0779301795470304, 1.10706790273964, 1.1345270275226826, 1.1659330223498876, 1.203282621558305, 1.243108037027234, 1.2796652265838711, 1.3102149398869782, 1.3375411725579163, 1.3673915734454201, 1.4031930827807113, 1.4429012191330601, 1.480879766208586, 1.51308268411811, 1.5407740197919979, 1.5693657480618304, 1.6034420269588512, 1.6425445439609669, 1.6815938864119455, 1.7155595300926432, 1.7440848799886342, 1.7718151221019518, 1.8041264608631919, 1.8421832615716605, 1.881867538308936, 1.917565011201203], [2.236828341079026, 2.3343347289683307, 2.4296735292091727, 2.5246759268853562, 2.621482394047232, 2.7205747495798991, 2.8203331771422637, 2.9185254768408786, 3.0143593395176573, 3.1092107921359022, 3.2053590849361133, 3.3038911592761777, 3.403702318759612, 3.5025118820079224, 3.5989600306020901, 3.6938580198658935, 3.789442314462522, 3.887318393097225, 3.9869846787997489, 4.0862936864776493, 4.183426410806649, 4.2785647113370038, 4.373724111661689, 4.4709007363200763, 4.5702360831020421, 4.669886930632499, 4.7677199876032033, 4.8632732309633786, 4.9581806877818693, 5.0546701182957454], [5.1238628072494139, 5.4009258809156506, 5.648486980522768, 5.8914694695518932, 6.1590062649342157, 6.4576551675777791, 6.7653696504554777, 7.0517683338810073, 7.30606748588154, 7.5469955356418179, 7.8055742420822769, 8.0965974317717659, 8.4050296230053778, 8.6998295783442625, 8.9624894751629061, 9.2040509124178254, 9.454953315487904, 9.7370480688596288, 10.043508454003053, 10.345106102905195, 10.617083424827653, 10.861915621056006, 11.107034996252837, 11.3796098240615, 11.681565961611341, 11.987816225354514, 12.269325431924406, 12.519805211820286, 12.761495507325975, 13.024717272138854], [10.311441663875298, 11.009042928192788, 11.718194303999999, 12.429138219605999, 13.130469050495572, 13.81961939790877, 14.50522054342065, 15.199166888466355, 15.905680296515492, 16.617428531268288, 17.322266480895269, 18.014402317843224, 18.699722478377243, 19.390379700225285, 20.093619851556319, 20.805120113201802, 21.512963358663537, 22.208594705257468, 22.894686833800549, 23.582682738193313, 24.282275089599828, 24.992494839279452, 25.70260215753002, 26.401960583586732, 27.089816138596767, 27.775990530299396, 28.471851120225661, 29.179859823929963, 29.891309637183092, 30.594329815506111], [20.914797412677238, 22.607414457823346, 24.389427275083467, 26.185314025898297, 27.906797241181252, 29.534005719284277, 31.133744017152306, 32.798072648753113, 34.559668073094137, 36.36178010850626, 38.11040778795352, 39.760723414618305, 41.358286939621948, 42.997158353074262, 44.733419362946428, 46.533612131396367, 48.305500256581979, 49.982870495144859, 51.586408912795974, 53.204682210899662, 54.912709909685567, 56.702991747319722, 58.492403386045481, 60.198620544969444, 61.815807564256971, 63.419982683871673, 65.099127224328853, 66.872295966360483, 68.672098273385785, 70.406656731995781], [42.18023570452177, 46.169088023876078, 50.328993661053751, 54.515446217729654, 58.559532180219385, 62.423229224976147, 66.234363767510658, 70.169087945472441, 74.289926155661945, 78.488290411958303, 82.584315638979689, 86.492226792899061, 90.299200041166898, 94.185213396190662, 98.257575760738561, 102.45226761761484, 106.5928002785283, 110.55247877018812, 114.3708846084635, 118.21748473523306, 122.23582439355853, 126.41155229320653, 130.58561512070483, 134.60049042223676, 138.44501202122822, 142.26463614959448, 146.22770965892309, 150.37069270149544, 154.56463743442407, 158.63374207172973], [85.035829418234854, 94.210527429365342, 103.82209920618266, 113.50147237285995, 122.8172382684152, 131.67228708007517, 140.39309015729427, 149.42954375866589, 158.9413365065746, 168.65113240421749, 178.09955227206447, 187.06752484698239, 195.77769989126091, 204.68974502796527, 214.07772944815613, 223.77814596056305, 233.34023874918654, 242.44042619176113, 251.17980031099299, 259.99118323509379, 269.24119252916427, 278.89317469658414, 288.54090423476862, 297.78206548883998, 306.58813980934832, 315.33062546705537, 324.4394838560483, 334.0078349708844, 343.70634331304001, 353.08600742944475], [169.46660691788566, 190.50986524053832, 212.9958344854027, 235.70570778076166, 257.21482190345978, 277.20248607610137, 296.74682358884684, 317.33355021845932, 339.49001399487832, 362.30035385448298, 384.24753807827568, 404.60811625817826, 424.1173562658563, 444.29324236237164, 466.04084746910496, 488.82021329779616, 511.1427855106254, 531.93998371358464, 551.54564934271775, 571.38911338741002, 592.68107607044567, 615.30049464660954, 637.90586954442063, 659.16861288551024, 678.99454605289634, 698.61048707711063, 719.43631979668805, 741.77955920514887, 764.5526235841329, 786.27275211962024], [340.5217487777731, 387.49643369392317, 437.30044477916653, 487.54355809873624, 535.4318411486496, 580.33638151498963, 624.37150604688236, 670.45087850212815, 719.6086905253286, 770.04883061925977, 818.79622077222621, 864.43208946173957, 908.39838364929346, 953.67204939384624, 1002.0280413741036, 1052.4074377425411, 1101.8910079885479, 1148.3831400071629, 1192.5385362039644, 1237.1602831226967, 1284.6227066040476, 1334.6884275574846, 1384.7266072023604, 1432.1317281101058, 1476.7190949120968, 1520.894642369801, 1567.4429300506213, 1616.9670311032796, 1667.3340695860963, 1715.6361767715096], [681.27337985555198, 785.69149839927127, 898.10826519985085, 1011.7663962374511, 1118.7673029375599, 1217.3330180801916, 1313.4408506624263, 1415.3278755722667, 1525.9178049238262, 1640.1329406230011, 1749.5625865781865, 1850.195803898984, 1946.1090496146433, 2045.7183008809127, 2154.0414443953136, 2268.0848545086078, 2379.5957188408956, 2482.6496359239009, 2579.0974825891285, 2676.8637263447331, 2782.6607064940754, 2895.8173403357537, 3008.8961135044133, 3114.5310963784004, 3212.2001458041855, 3308.7049611037314, 3411.9176330855248, 3523.5430800592594, 3637.5515538045388, 3745.7223622770985], [1365.0037030220192, 1594.9837857047785, 1842.395541745032, 2092.5126368879091, 2328.1214605838982, 2545.3472401434333, 2757.2164888782549, 2981.6804898374353, 3225.1109689586488, 3476.4419596257908, 3717.3438013425061, 3939.0753450609777, 4150.5205253046142, 4370.0205117375926, 4608.5109223602522, 4859.4676667517633, 5104.905164715663, 5331.9122057677232, 5544.5224565120534, 5760.0059261674896, 5992.9909997365276, 6242.015168296276, 6490.8696529574636, 6723.5016814246146, 6938.7733328133663, 7151.5077368637503, 7378.8607568175803, 7624.547967872244, 7875.4285744794734, 8113.586997170547], [2717.603802533049, 3219.6939925321803, 3763.6940413077491, 4314.1983640797434, 4829.821376551834, 5301.2472102540187, 5759.7946790516162, 6248.6229061115946, 6783.0510251013684, 7336.473839342766, 7864.8225169418038, 8347.0812715981756, 8804.6091796104938, 9281.5027436297696, 9804.0537714835173, 10356.576809310018, 10895.830275501612, 11390.77257141601, 11851.101584012333, 12318.338493305024, 12827.653390943269, 13375.530060143943, 13922.998769186141, 14431.464863037261, 14898.1925112016, 15358.820017661177, 15854.594128549126, 16394.447963974002, 16946.787948589183, 17468.540799065297], [5514.6959644222225, 6655.7248029938237, 7873.2521444412914, 9102.6518051364874, 10268.382245886913, 11353.43911469164, 12414.988969551383, 13531.810608679718, 14731.866206732571, 15966.593020383743, 17155.551750580431, 18260.382063127559, 19320.070903038988, 20415.108077089259, 21593.484296662871, 22826.568739027851, 24035.432093717747, 25163.413806573306, 26228.215531932965, 27305.626313269451, 28459.842486140031, 29684.445863331748, 30908.304586586008, 32060.971429040164, 33137.452650721018, 34202.799220046334, 35332.299253459496, 36542.25846838038, 37775.00878180717, 38951.928079878278], [10926.907879165756, 13301.920432514156, 15913.453390962453, 18561.693548275856, 21013.079268866921, 23215.035978429965, 25344.312985097655, 27644.480980665016, 30201.994269836909, 32866.705081186788, 35389.90873576438, 37653.001581962177, 39776.524645834579, 42009.338767646943, 44499.823093016166, 47159.455970715964, 49744.20135057588, 52078.874402578032, 54218.205641669323, 56396.521944722008, 58812.30750059105, 61445.718362237632, 64076.826880121567, 66487.822168940271, 68663.264431089541, 70804.280235376631, 73143.647677201545, 75731.781271157422, 78390.381078812119, 80876.36084983038]]
fullbase=[[0.0011173663520436191, 0.0011507373022136285, 0.0011893490433491445, 0.001228774138225113, 0.0012638373559384804, 0.0012933737553336619, 0.001321299726528584, 0.0013530122799016214, 0.0013904270596393083, 0.0014302171093056842, 0.0014668716602464704, 0.0014977627068756022, 0.0015255611828913882, 0.0015557813171519267, 0.00159171087709314, 0.0016313884105105033, 0.0016694065956701851, 0.0017018837079739893, 0.0017300324596534471, 0.0017590450377368561, 0.0017933194312404609, 0.0018324159403492828, 0.0018714614343992321, 0.0019056296857360789, 0.0019345785811634621, 0.0019627646592378888, 0.0019953457892722612, 0.0020334390500763291, 0.0020730936928506768, 0.0021089234414130948], [0.0034001426662712674, 0.0035210438355559627, 0.0036618770171702813, 0.0038058035823768368, 0.003933140859829409, 0.0040394582928373708, 0.0041396508727544893, 0.0042542447526200461, 0.0043905255967157273, 0.0045358401744246008, 0.0046692296821069625, 0.0047806991705102069, 0.0048804068550175987, 0.0049893246992719137, 0.0051199568885194318, 0.005264843539360518, 0.005403419282144226, 0.0055209209669833184, 0.0056219608356768442, 0.0057262860478705258, 0.005850623233547186, 0.005993300106559336, 0.0061357829568010423, 0.0062597164578067355, 0.0063637994692537277, 0.0064649812993743802, 0.0065828785891330057, 0.0067217398629900588, 0.0068665394551062622, 0.0069967920372208375], [0.0081617168826457389, 0.0085174972157123548, 0.0088653684766431366, 0.0092120122752600182, 0.0095652387445755993, 0.00992680594051964, 0.01029080349342492, 0.010649086574642228, 0.010998764214438633, 0.011344857246237558, 0.01169568217552404, 0.012055205023055324, 0.012419394983666884, 0.012779930329951686, 0.013131849370060599, 0.013478112204306473, 0.013826879222587705, 0.014184008479549223, 0.014547669826157735, 0.014910027540282783, 0.015264444453487193, 0.015611584133079344, 0.015958800801390054, 0.016313377897677332, 0.016675831717661901, 0.017039436733622557, 0.017396409013566691, 0.017745062732406867, 0.018091360111771607, 0.018443429780936334], [0.01869589937246359, 0.019706844345026217, 0.020610142809661669, 0.021496734885806251, 0.022472920469429315, 0.023562627598906125, 0.024685413126885443, 0.025730421778981681, 0.026658305981809703, 0.027537401840494507, 0.028480901238767391, 0.029542783743074501, 0.030668188038125793, 0.031743851167166763, 0.03270224197207966, 0.033583648928721038, 0.034499139108019106, 0.035528443623174324, 0.036646653211881798, 0.037747119697219444, 0.038739507829676889, 0.039632849098952941, 0.040527238223977385, 0.041521806529937359, 0.042623581065067841, 0.043741023964911294, 0.044768191942751452, 0.045682140058837736, 0.046564017192175941, 0.047524458135407531], [0.037624285228731548, 0.040169685745960561, 0.042757230194492152, 0.045351315244316175, 0.047910324166757737, 0.050424889062895537, 0.052926503666627829, 0.055458568150967148, 0.058036487209122758, 0.060633507050606411, 0.063205312712825854, 0.065730771033323171, 0.068231360381878103, 0.070751423546385014, 0.073317399178160172, 0.075913514217849601, 0.078496285573457919, 0.081034498274596398, 0.083537904372303101, 0.086048256948292379, 0.088600922524180947, 0.091192365244614465, 0.093783397726373952, 0.096335209757785423, 0.098845050228350495, 0.10134875648705113, 0.10388780564896818, 0.10647118072695741, 0.10906711169105729, 0.11163228468752054], [0.076313703651402581, 0.082489707799561246, 0.088991898347051804, 0.095544711964557438, 0.10182604270564974, 0.10776338472846728, 0.11360049383234516, 0.11967327950004387, 0.12610097126842515, 0.13267649964211656, 0.13905687483260692, 0.14507852998802512, 0.15090770380242316, 0.15688760142711383, 0.1632228532373253, 0.16979137860891774, 0.17625662628121375, 0.18237699803397961, 0.18822797297692082, 0.19413271240430857, 0.2003649467913616, 0.20689730925770272, 0.21342649655096887, 0.21965212465827905, 0.22555290048238519, 0.23140619861708411, 0.23753304442485887, 0.24400296479909647, 0.25057006545894733, 0.25689910501713886], [0.15390682223630198, 0.1684613066906388, 0.1836399287805163, 0.19891541500478976, 0.21367143542386269, 0.2277692545638007, 0.24167528417125522, 0.25603226640456039, 0.27106833965751775, 0.28638728917224932, 0.30133282506035269, 0.31559197219966217, 0.32948281811820934, 0.34366206478788652, 0.35852125986002525, 0.37382680956047681, 0.38893474372829129, 0.40338277901187469, 0.41731534005051552, 0.43135077612707101, 0.44601285368897242, 0.46124920789192903, 0.47647948659627659, 0.49112892344775322, 0.50515677541293735, 0.51909378173627885, 0.53355420472638193, 0.54867107982228958, 0.56397390342435216, 0.57882121173390666], [0.31027788402296114, 0.34375443037899395, 0.37882503736252721, 0.41414303737936764, 0.44813431082141064, 0.48044452437490748, 0.51226490343503372, 0.54523702497118243, 0.57994355923182428, 0.6153725654051847, 0.64984786533478611, 0.68257011398642087, 0.71435171358623384, 0.7468698947605894, 0.7811246784331376, 0.81651946119944285, 0.85140952974564432, 0.88461420268423607, 0.91650234357674809, 0.94865322947637787, 0.9824045708884892, 1.0176226269011492, 1.0528251659627814, 1.0865442227350244, 1.118675738654952, 1.1505752328979368, 1.1838115442991104, 1.2187244481634132, 1.2541122684171873, 1.2883366930484836], [0.61834806065591197, 0.69513049119102377, 0.77717707091199251, 0.86004062949336524, 0.93852287001312495, 1.0114536591696179, 1.0827668424427483, 1.1578834847016122, 1.238727768164372, 1.3219579081406989, 1.4020385744646315, 1.4763300485216782, 1.5475151683692938, 1.621132739799398, 1.7004851838367954, 1.7836023060788655, 1.8650526843433148, 1.9409372931742905, 2.0124742498652148, 2.0848788830368479, 2.1625687835550815, 2.2451022918616022, 2.3275845577349865, 2.405167843010521, 2.4775085096923477, 2.5490829591420905, 2.6250720493109574, 2.7065978378321551, 2.7896919674075482, 2.8689441552065489], [1.2424923517228506, 1.4138931122980498, 1.5956174899057749, 1.7789440593550878, 1.953678347664781, 2.117525585508079, 2.2782005075488039, 2.4463344609697799, 2.6257009939019138, 2.8097464726752488, 2.9876154623914912, 3.1541311637071008, 3.3145549382757054, 3.4797490371077719, 3.6561898970854152, 3.840013734760606, 4.0205688910385335, 4.1902089174267356, 4.3513226855156635, 4.5141380694552646, 4.6873184856297829, 4.869997787587474, 5.0525765970938998, 5.2255479282108723, 5.3882378663243093, 5.5494251621325059, 5.7192700887394059, 5.8999731334193353, 6.0837518797650523, 6.2599961254421164], [2.4858234956831393, 2.866823282444277, 3.2770084569785638, 3.6917231089272491, 4.0821469472855387, 4.4417925430408216, 4.792469841488554, 5.1642341991093312, 5.5677536274280079, 5.9845006724158001, 6.3837864702806204, 6.7509759473085733, 7.1009432391434135, 7.4643964790712651, 7.8596448818951767, 8.275765336282463, 8.6826450629494705, 9.0586671650627704, 9.4105851034963859, 9.767313596049398, 10.153344559248517, 10.566229353243694, 10.978830049993768, 11.364269919154543, 11.720643770008854, 12.072769575025683, 12.449370940426132, 12.856668755089425, 13.272661734006462, 13.667354298253054], [4.980611861549713, 5.8197608874417384, 6.722514428763855, 7.6351391843502343, 8.4948263041639223, 9.2874375563629581, 10.060503952454088, 10.879525954513936, 11.767752652426628, 12.684806657862989, 13.563806888900523, 14.372858728305044, 15.144377787526224, 15.945287143023011, 16.815488568398862, 17.731177027767167, 18.626726915962863, 19.455027937283209, 20.230798094096613, 21.017052023340675, 21.867165629928643, 22.775802525927769, 23.683820281014661, 24.532645700165318, 25.318126749036082, 26.094349915191081, 26.923913340868417, 27.820374379692563, 28.735785028274957, 29.60477509940592], [9.9159655786445633, 11.747987243011494, 13.732929180983302, 15.741603848870525, 17.623003940548564, 19.34313780830276, 21.016281226976744, 22.799912773590925, 24.749928749879622, 26.769252380255491, 28.697085751592084, 30.456746672994708, 32.126169928470972, 33.866254395928863, 35.77293336085134, 37.7889738960423, 39.756596550947528, 41.562537050857017, 43.242180948728361, 44.947030310986435, 46.805413416339888, 48.804500328152614, 50.802098679018698, 52.657384677601726, 54.360375852947286, 56.041108892241922, 57.850084510308761, 59.819897786468701, 61.835270398932721, 63.739036982221464], [20.121967488024161, 24.285342103915834, 28.72784369211594, 33.213664880063959, 37.467170454969704, 41.426315107295707, 45.299687602209389, 49.374735230844465, 53.753486096463739, 58.258744946845994, 62.597005672000364, 66.628299468119209, 70.494881510299621, 74.490442200602516, 78.790089566820512, 83.289355749277433, 87.700244269236379, 91.816012663286614, 95.701250550761685, 99.632496235594431, 103.84398866500288, 108.31230922166624, 112.77791269248915, 116.98375194056746, 120.91160585742433, 124.79883176611287, 128.92014019303048, 133.33502727684163, 137.83307429297017, 142.12740565857905], [39.869992200421216, 48.535914254953326, 58.064849598409886, 67.727721802013463, 76.672313505448926, 84.706791127735471, 92.476075776894461, 100.8689057574407, 110.20073467183821, 119.92370483318354, 129.13034509596972, 137.38789564224777, 145.13618536247475, 153.28325520200249, 162.37050950356644, 172.07495135138871, 181.50614444596775, 190.02487613138268, 197.83084656326659, 205.77906530668221, 214.59375948508162, 224.20252270294904, 233.80288515191876, 242.60010065180754, 250.53783262351521, 258.34994968003991, 266.88581020809619, 276.32936618438646, 286.03003857655887, 295.10085670525257]]
actual=[[0.24064512066192703, 0.24475180054721687, 0.27724279732530455, 0.29575263238277943, 0.33687759604281481, 0.38370221971547697, 0.43185671069650611, 0.47789976594892042, 0.52052730897626376, 0.56079079891495509, 0.60108226127932007, 0.64360272192376966, 0.68942028499575336, 0.73866955205491225, 0.79143930701010001, 0.84834820235561215, 0.91020568862605966, 0.97711619450432907, 1.0480092952799767, 1.1212769572990493, 1.1962322803951166, 1.2743452560429693, 1.3593416782504386, 1.4561354252987633, 1.569373082328716, 1.7023437637491474, 1.8561540559260574, 2.028156451383361, 2.2084715890244659, 2.3741802023951224], [0.67034163096824961, 0.89653993237718244, 0.97968445131906867, 0.98650740884118293, 1.2501698841422557, 1.4435212419718375, 1.6064777857836603, 1.7678482213057707, 1.9503111179063193, 2.172885293203263, 2.4495215689032142, 2.7861498719448039, 3.1800534344155613, 3.6233889707704461, 4.1089065050033531, 4.6338976161744414, 5.1999688753477447, 5.8099474639462798, 6.4656581560735233, 7.1692197885203619, 7.9268890660766536, 8.7516494411920753, 9.6612957743978107, 10.672184049208733, 11.791947487100156, 13.014437291804121, 14.316958508213039, 15.65646082635433, 16.960837255165846, 18.114337400601347], [1.6822777953200239, 2.0841973564876137, 2.4755155156553026, 2.7002400390343735, 3.4619434055456462, 4.0974318803574485, 4.72621280006459, 5.4386940809396265, 6.2996934520508008, 7.3525598607742992, 8.6244457523852525, 10.131794644433143, 11.884494302917732, 13.887956494174038, 16.143874410447989, 18.651208435196814, 21.408324807000625, 24.415735598646862, 27.677919408894937, 31.203131180292434, 35.001542171990828, 39.083170191642772, 43.456836852639952, 48.130028207926479, 53.108288378714718, 58.392788986095759, 63.975978179293278, 69.836562491637906, 75.935271977794358, 82.211722767952494], [3.4757776476620559, 4.5826438524459974, 6.0009208404988925, 6.6131460806913474, 8.6889726043267714, 10.597571995476565, 12.718932183256827, 15.341120863465708, 18.656229363860184, 22.769094279906852, 27.726128885841273, 33.551530609397929, 40.269772457857911, 47.904319873169598, 56.462795842974444, 65.929699623596989, 76.27926279326239, 87.500935303466335, 99.616805352572896, 112.67609603056881, 126.73138031298892, 141.81638716569788, 157.94223178043262, 175.11038701836949, 193.32374446772317, 212.577293039647, 232.82710568620442, 253.95469135488977, 275.74645359257516, 297.89253134609334], [7.8817257248821733, 10.840669944103839, 14.153396572854394, 17.691622735672969, 21.886759838433534, 26.891972934563285, 33.980553166048878, 43.630635415822091, 55.88238950232563, 70.601076159889942, 87.650561223608719, 106.99073241513562, 128.71653065419619, 153.05298332639939, 180.31368191819698, 210.82688107636446, 244.83772758567272, 282.40398865428023, 323.30880755791497, 367.01272384832498, 412.66055674904715, 459.15378249681953, 505.30122164431776, 550.06909657660788, 592.95915796887186, 634.54450382040136, 677.18699065644557, 725.9539411273704, 789.75179651225801, 882.701412757301], [17.130180753524336, 24.374000767245139, 32.704793719291658, 43.444471237993149, 54.060896888531992, 69.024903560885917, 91.38382371929869, 121.79247387154439, 159.8340098737784, 204.89945478745724, 256.65999208270119, 315.22691936174323, 381.11948508762248, 455.12739723345527, 538.09333698662465, 630.60783481138117, 732.63468811975883, 843.14597894567123, 959.88571435555787, 1079.3634188328867, 1197.1199238603788, 1308.2614469653872, 1408.2672634034307, 1494.1323799698148, 1565.9580382559852, 1629.1023307008102, 1696.951207139592, 1794.3144959833703, 1961.4434303017949, 2258.7130331671051], [36.885989789805301, 54.120930213602605, 74.997811250514474, 94.850522982261623, 131.76329805186023, 180.62085079536527, 246.99861436912335, 332.96739760731793, 439.06955929552606, 565.540681037951, 712.84120094733169, 881.67881200391105, 1072.7508911841701, 1286.3722523786473, 1522.0359242562158, 1777.891557006436, 2050.1754705990556, 2332.7428457039473, 2616.9290277208315, 2891.9330589507126, 3145.8035003110022, 3367.018293146125, 3546.6680361941467, 3681.3594087567776, 3777.0538559754214, 3854.0556112641675, 3953.2636213427104, 4143.6954496275248, 4531.2756700910795, 5268.9709352570189], [78.736787847539944, 120.17105858126186, 170.30561663686393, 200.81104374595478, 323.70598245911862, 472.92144208436304, 657.50908301085224, 886.30201778809214, 1167.4080744482919, 1507.4836242027425, 1910.7307232232292, 2377.8574571532299, 2905.3651506092706, 3485.3627153388247, 4105.808078617426, 4750.9154818269153, 5401.5936300342801, 6036.0771874754364, 6631.1094180632081, 7163.9473025887601, 7615.1717229461183, 7972.0597559356893, 8232.3211325784014, 8408.2751083065741, 8531.795266390016, 8660.3471185974631, 8884.1892174674067, 9334.5365176619616, 10192.444974011796, 11698.405386870929], [169.43397218515796, 265.3942236389675, 383.99634261730051, 434.68110527414751, 785.47781873044414, 1223.1852540158357, 1755.8706258154887, 2400.1204309772579, 3177.6325802136216, 4109.5099739302696, 5209.2754364333641, 6476.3460396415339, 7891.8504510096363, 9417.8702332762623, 10999.931080955121, 12571.774658601113, 14061.595292114087, 15399.645120095916, 16527.493135075303, 17408.674857998463, 18039.252723420126, 18455.799274233963, 18738.200774344528, 19005.321177225374, 19402.133052910838, 20076.650156689131, 21143.893890784741, 22632.964606426402, 24412.894285203212, 26093.450312700646], [360.87733743885951, 580.21834800804879, 864.32242059445718, 1096.7893389421579, 1886.5597164181183, 2938.709446056725, 4316.6037509984844, 6066.2141228058763, 8210.951057908127, 10747.254978499795, 13640.663606406673, 16823.833974302888, 20198.634408485119, 23643.199218219408, 27022.729340175018, 30201.614074452245, 33055.101853450491, 35480.510330284487, 37409.066476997563, 38818.742948141335, 39746.422543940447, 40296.097446491032, 40639.936977212645, 41010.668911771689, 41685.182288806289, 42959.077987047167, 45110.082950427932, 48346.318091004367, 52734.988021968122, 58108.379549667734], [789.48532813601946, 1302.5282208231681, 1983.6856505818505, 2365.5567937886958, 4749.4440544690033, 7992.7614272994751, 12073.102917295702, 16921.05669689889, 22434.023529118476, 28486.105839853593, 34932.079568087938, 41608.901189387288, 48340.468458426971, 54948.361962006304, 61265.795844426517, 67149.05556883823, 72483.010985704677, 77182.740114841159, 81196.874839493976, 84516.696592932756, 87189.723601431018, 89332.401731281672, 91137.335129808009, 92875.512938553118, 94898.588944988936, 97646.222367663169, 101658.83478694693, 107591.15865427611, 116221.22503914239, 128453.63141689412], [1669.9388350036349, 2828.2520286574581, 4437.7936483718249, 8272.915875807972, 11174.792377105261, 16754.198696715506, 25660.720894508351, 37636.517842124267, 51935.850983753262, 67633.222576413435, 83828.073879224045, 99765.850883554216, 114900.18385938511, 128914.40763493405, 141708.66599455211, 153352.41347810806, 164007.16299957762, 173836.19879387578, 182925.76702234586, 191238.80623506726, 198610.75883750367, 204788.00514117657, 209511.25765406468, 212657.19368193569, 214461.63050033234, 215847.44128519544, 218870.26918174836, 227284.24475833707, 247228.3260332004, 288043.01849750866], [3552.2404748726781, 6173.3940049971625, 10029.417015487734, 13659.99502688863, 26879.04452418031, 44785.076601147943, 67218.322574976279, 93755.354729643048, 123785.45180553547, 156566.37619305553, 191249.14714458963, 226889.8992369489, 262478.7890775486, 297000.23917091836, 329509.99662144942, 359199.02486539335, 385426.35227730818, 407731.54240262206, 425856.18635094794, 439795.52295180125, 449873.59294855641, 456813.69642025314, 461780.24081152357, 466394.37029386417, 472749.87250451586, 483455.60368953843, 501706.29237912456, 531357.49063156056, 576976.6286267105, 643864.09886020247], [7448.1838669517483, 13200.091682189845, 22283.518501477873, 34695.120087847252, 69284.77011199588, 115868.78249351567, 173372.46382321254, 239858.30802996931, 312870.59247357585, 389751.00779983989, 467877.28629683604, 544835.35424466839, 618563.73748087825, 687486.8697773139, 750607.89459528937, 807509.86285983946, 858242.85639670608, 903133.19311985641, 942591.59910715604, 976988.62230348273, 1006621.5331515325, 1031763.9934804873, 1052804.1874508657, 1070531.6505500143, 1086683.5627597326, 1104867.336957464, 1131938.3613331127, 1179870.6606903838, 1268157.8115573425, 1426828.0793879023], [15845.956334172237, 28639.586785878899, 50021.823697300453, 125837.93867342947, 220129.64937391566, 332077.83295794617, 459293.80964447372, 599031.34730417456, 748419.11360202101, 904584.98722953966, 1064613.4467787691, 1225438.1247531115, 1383838.6243811632, 1536622.2394561353, 1680908.6197312365, 1814348.178028737, 1935173.3540800826, 2042142.9221618145, 2134545.2659297045, 2212379.7309801616, 2276678.8431235272, 2329812.070364737, 2375636.1765139415, 2419505.6585943378, 2468292.7998228441, 2530565.4307226348, 2616932.8960942286, 2740423.4791779099, 2916735.0140403928, 3164324.408677212]]


def timeEstimator(numInputs, sizeArray, funcArraySize):
    #numInputsArray (standardized against 3)
    baseInterceptsMultiplier = [0.3617403453,1,3.2774174234,7.4853308053,11.4227123042,21.8044606327,52.6621594651,105.4801915976,0.1120042641,452.1781758308,920.9937630975,1896.6371120647,3666.0032431893,7309.3025646143,15343.7763197286]

    #running initiation
    startTime=time.clock()
    for n in range(10):
        multipleRegression([np.sin,np.cos,np.tan], {'bob':range(1,2001),'mary':range(1,2001)}, range(1,2001), 'ols')
    baseSpeed = (time.clock()-startTime)/10.0

    startTime=time.clock()
    for n in range(10):
        multipleRegression([np.sin,np.cos,np.tan], {'bob':range(1,9),'mary':range(1,9)}, range(1,9), 'ols')
    baseIntercept = (time.clock()-startTime)/10.0


    if sizeArray<10000:
        if funcArraySize<=30:
            return (baseSpeed-baseIntercept)*sizeArray/2000*actual[numInputs-1][funcArraySize-1]+baseIntercept*base[numInputs-1][funcArraySize-1], 200

        elif funcArraySize<90:
            theTens = int(funcArraySize/10)
            theOnes = funcArraySize%10
            return (baseSpeed-baseIntercept)*sizeArray/2000*actual[numInputs-1][funcArraySize-1]+baseIntercept*base[numInputs-1][funcArraySize-1], 200

        else:
            return (baseSpeed-baseIntercept)*sizeArray/2000*actual[numInputs-1][funcArraySize-1]+baseIntercept*base[numInputs-1][funcArraySize-1], 200
    else:
        startTime=time.clock()
        for n in range(10):
            multipleRegression([np.sin,np.cos,np.tan], {'bob':range(1,10001),'mary':range(1,10001)}, range(1,10001), 'ols')

        baseSpeed = (time.clock()-startTime)/10.0
        if funcArraySize<=30:
            return (baseSpeed-baseIntercept)*sizeArray/10000*actual[numInputs-1][funcArraySize-1]+baseIntercept*base[numInputs-1][funcArraySize-1],200

        elif funcArraySize<90:
            theTens = int(funcArraySize/10)
            theOnes = funcArraySize%10
            return (baseSpeed-baseIntercept)*sizeArray/10000*actual[numInputs-1][funcArraySize-1]+baseIntercept*base[numInputs-1][funcArraySize-1],200

        else:
            return (baseSpeed-baseIntercept)*sizeArray/10000*actual[numInputs-1][funcArraySize-1]+baseIntercept*base[numInputs-1][funcArraySize-1],200
